$(function () {
    /**
     * 头部四道杠点击显示隐藏
     * sufeng
     *
     * */
    var state = 0;
    $('.sidebar-toggler').on('click',function () {
        if (state == 0){
            $('body').addClass('page-sidebar-closed');
            $(this).css('margin-left','10px');
            $('.header .brand').css('width','0');
            state = 1;
        }
        else{
            $('body').removeClass('page-sidebar-closed');
            $(this).css('margin-left','18px');
            $('.header .brand').css('width','225px');
            state = 0;
        }
    })
    /**
     * 日期实时刷新
     * sufeng
     * */
    window.onload=function(){
        setInterval(function(){
            fnDate();
        },1000);
    }
    function fnDate(){
    	var oDiv = $("#nt-title-container #Date");
        var date=new Date();
        var year=date.getFullYear();//当前年份
        var month=date.getMonth();//当前月份
        var data=date.getDate();//天
        var hours=date.getHours();//小时
        var minute=date.getMinutes();//分
        var second=date.getSeconds();//秒
        var time=year+"-"+fnW((month+1))+"-"+fnW(data);
        oDiv.html(time)
        $('.header-hour').html(fnW(hours));
        $('.header-min').html(fnW(minute));
        $('.header-sec').html(fnW(second));
        if (fnW(hours)>12) {
            $('.header-meridiem').html('PM')
        }else{
            $('.header-meridiem').html('AM')
        }
    }
    fnDate();
    function fnW(str){
        var num;
        str>=10?num=str:num="0"+str;
        return num;
    }
})